package com.ruoyi.common.utils.bean;

import java.lang.reflect.Field;

import com.baomidou.mybatisplus.annotation.TableId;

public class BeanIdUtils {
	
	public static Object getId(Object t) {
		Object o = null;
		Field[] fields = t.getClass().getDeclaredFields();
	    for (Field field: fields) {
	        if (field.isAnnotationPresent(TableId.class)) {
	        	field.setAccessible(true);
	        	try {
	        		o = field.get(t);
	        		//BeanUtils.copyProperty(a, null, field.get(t));
	        		break;
				} catch (Exception e) {
				}
	        }
		}
	    return o;
	}
}
